package com.powernode.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.powernode.dto.visitLogDto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.powernode.mapper.VisitLogMapper;
import com.powernode.domain.VisitLog;

import java.util.List;

@Service
public class VisitLogServiceImpl implements VisitLogService {

    @Resource
    private VisitLogMapper visitLogMapper;

    @Override
    public int insert(VisitLog record) {
        return visitLogMapper.insert(record);
    }

    @Override
    public int insertSelective(VisitLog record) {
        return visitLogMapper.insertSelective(record);
    }


    //更据客户id查询当前客户的拜访记录
    @Override
    public PageInfo<VisitLog> listVisitLogByCustomerId(visitLogDto visitLogDto) {
        Page<VisitLog> page = PageHelper.startPage(visitLogDto.getPage(), visitLogDto.getLimit());
        List<VisitLog> visitLogs = this.visitLogMapper.listVisitLogByCustomerId(visitLogDto);
        PageInfo<VisitLog> info = page.toPageInfo();
        return info;
    }

}
